<%--
  Created by IntelliJ IDEA.
  User: 郑自航
  Date: 2018/7/9
  Time: 14:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="basePath" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>WashCarOrder</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="stylesheet" href="${basePath}/layui/css/layui.css">
    <script type="text/javascript" src="${basePath}/js/plugin/jquery-2.1.0.min.js"></script>
    <script type="text/javascript" src="${basePath}/js/plugin/jquery.i18n.properties.min.js"></script>
    <script src="${basePath}/layui/layui.js"></script>
</head>

<body class="page-body">
<div class="layui-inline"></div>
<div id="content">
    <form class="layui-form" action="" lay-filter="example">
        <input name="id" type="hidden" value="${id}" id="washCarOrder_id">

                    <%--<div class="layui-form-item">--%>
                        <%--<div class="layui-inline">&lt;%&ndash;(1下单中,2下单成功,3支付成功,4支付失败,5已撤销,6)&ndash;%&gt;--%>
                            <%--<label class="layui-form-label l-lab-text">订单状态:</label>--%>
                            <%--<div class="layui-input-inline">--%>
                                <%--<select name="status" id="status_selectId" lay-search="">--%>
                                    <%--<option value="" class="l-lab-text">All</option>--%>
                                <%--</select>--%>
                            <%--</div>--%>
                        <%--</div>--%>
                    <%--</div>--%>

                    <%--<div class="layui-form-item">--%>
                        <%--<div class="layui-inline">--%>
                            <%--<label class="layui-form-label l-lab-text">服务类型(洗车类型):</label>--%>
                            <%--<div class="layui-input-inline">--%>
                                <%--<select name="serverType" id="serverType_selectId" lay-search="">--%>
                                    <%--<option value="" class="l-lab-text">All</option>--%>
                                <%--</select>--%>
                            <%--</div>--%>
                        <%--</div>--%>
                    <%--</div>--%>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label l-lab-text">服务状态:</label>
                            <div class="layui-input-inline">
                                <select name="serviceStatus" id="serviceStatus_selectId" lay-search="">
                                    <option value="" class="l-lab-text">All</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <%--<div class="layui-form-item">--%>
                        <%--<div class="layui-inline">--%>
                            <%--<label class="layui-form-label l-lab-text">洗车时间:</label>--%>
                            <%--<div class="layui-input-inline">--%>
                                <%--<input class="layui-input Date" name="washStartTime" id="washStartTime" placeholder="yyyy-MM-dd HH:mm:ss" type="text">--%>
                            <%--</div>--%>
                            <%--<div class="layui-form-mid layui-word-aux"> -</div>--%>
                            <%--<div class="layui-input-inline">--%>
                                <%--<input class="layui-input Date" name="washEndTime" id="washEndTime" placeholder="yyyy-MM-dd HH:mm:ss" type="text">--%>
                            <%--</div>--%>
                        <%--</div>--%>
                    <%--</div>--%>

                    <%--<div class="layui-form-item">--%>
                        <%--<div class="layui-inline">--%>
                            <%--<label class="layui-form-label l-lab-text">订单类型:</label>--%>
                            <%--<div class="layui-input-inline">--%>
                                <%--<select name="orderType" id="orderType_selectId" lay-search="">--%>
                                    <%--<option value="" class="l-lab-text">All</option>--%>
                                <%--</select>--%>
                            <%--</div>--%>
                        <%--</div>--%>
                    <%--</div>--%>

                <%--<div class="layui-form-item">--%>
                    <%--<div class="layui-inline">--%>
                        <%--<label class="layui-form-label l-lab-text">洗车地点:</label>--%>
                        <%--<div class="layui-input-inline">--%>
                            <%--<input name="washAddress" id="washAddress_inputId" lay-verify="" placeholder="洗车地点" autocomplete="true" class="layui-input"--%>
                                   <%--type="text">--%>
                        <%--</div>--%>
                    <%--</div>--%>
                <%--</div>--%>

                <%--<div class="layui-form-item">--%>
                    <%--<div class="layui-inline">--%>
                        <%--<label class="layui-form-label l-lab-text">车辆信息:</label>--%>
                        <%--<div class="layui-input-inline">--%>
                            <%--<input name="carInfo" id="carInfo_inputId" lay-verify="" placeholder="车辆信息" autocomplete="true" class="layui-input"--%>
                                   <%--type="text">--%>
                        <%--</div>--%>
                    <%--</div>--%>
                <%--</div>--%>

                <%--<div class="layui-form-item">--%>
                     <%--<div class="layui-inline">--%>
                         <%--<label class="layui-form-label l-lab-text">洗车价格(单位):</label>--%>
                         <%--<div class="layui-input-inline">--%>
                             <%--<input name="money" id="money_inputId" lay-verify="" placeholder="洗车价格(单位)" autocomplete="true" class="layui-input"--%>
                                    <%--type="number">--%>
                         <%--</div>--%>
                     <%--</div>--%>
                 <%--</div>--%>

                <%--<div class="layui-form-item">--%>
                     <%--<div class="layui-inline">--%>
                         <%--<label class="layui-form-label l-lab-text">优惠价格(单位):</label>--%>
                         <%--<div class="layui-input-inline">--%>
                             <%--<input name="discounts" id="discounts_inputId" lay-verify="" placeholder="优惠价格(单位)" autocomplete="true" class="layui-input"--%>
                                    <%--type="number">--%>
                         <%--</div>--%>
                     <%--</div>--%>
                 <%--</div>--%>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn l-lab-text" lay-submit lay-filter="formDemo">OK</button>
                <button class="layui-btn layui-btn-warm l-lab-text" onclick="top.layer.close(top.addWashCarOrder_layer)" >Cancel</button>
                <button type="reset" class="layui-btn layui-btn-primary l-lab-text">Rest</button>
            </div>
        </div>
    </form>
</div>
<div class="ibox-content">
    <table class="table-hide" id="demoTable" lay-data="{id: 'idApply'}" lay-filter="Apply"></table>
</div>
<script src="${basePath}/js/i18n.js"></script>
<script src="${basePath}/js/common.js"></script>
<script src="${basePath}/js/DateFormate.js"></script>
<script>
    $(function () {
        doTranslate();
        // debugger
        /*初始化下拉选*/
        var types=['washCarOrder_status','washCarOrder_serverType'
            ,'washCarOrder_serviceStatus','washCarOrder_washTime','washCarOrder_orderType'];
        //批量初始化下拉选
        initBatchSelect(types,function () {
            doSetEditFormData();
            initForm();
        });
        //批量初始化日期时间选择器
        layui.use('laydate', function () {
            var laydate = layui.laydate;

            //日期时间选择器
            var ids=['washStartTime','washEndTime'];
            //批量初始化
            initBatchDate(laydate,ids);
        });

    })
    function doSetEditFormData() {
        debugger
        var id=$("#washCarOrder_id").val();
        if(id){
            $.post('${basePath}/washcarorder/washCarOrder/findWashCarOrderOne.do',{id:id},function (result) {
                if(result&&result.code==0){
                    var data=result.data;
                   // debugger
                    layui.use('form', function(){
                        var form = layui.form;
                        //表单初始赋值
                        form.val('example', {
                            "userId": data.userId,
                            "status": data.status,
                            "serverType": data.serverType,
                            "serviceStatus": data.serviceStatus,
                            "washTime": data.washTime,
                            "orderType": data.orderType,
                        })
                        form.render();
                    });
                }else {
                    top.myLayer.confirm(top._loadText(result.msg));
                }
            })

        }
    }
    function initForm(){
        layui.use(['form','element'], function(){
            var form = layui.form;

            //监听提交
            form.on('submit(formDemo)', function(data){
                debugger
                // top.layer.msg(JSON.stringify(data.field));
                var id=data.field.id;
                var url=id?'${basePath}/washcarorder/washCarOrder/updateWashCarOrder.do':'${basePath}/washcarorder/washCarOrder/addWashCarOrder.do'
                $.post(url,data.field,function (result) {
                    if(result&&result.code==0){
                        top.myLayer.msg(top._loadText('Add successful'),null,top.layer.close(top.addWashCarOrder_layer));
                    }else{
                        top.myLayer.confirm(top._loadText('Add failed')+top._loadText(result.msg));
                    }
                })
                return false;
            });
        });
    }
</script>
</body>
</html>
